<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
	<meta http-equiv="pragma" content="no-cache" />
	<link rel="stylesheet" href="/css/style.css" type="text/css"/>
	<script type="text/javascript" src="/js/jquery.js"></script>
	<script type="text/javascript" src="/js/util.js"></script>
</head>
<script type="text/javascript">
//////////////////////////////////////////////////////////////////////
////  email = "wenpin.qian@happyelements.com"                     ////
////  team = "Athene"                                             ////
////  warnings = "This is generated page,Do Not Modify!";         ////
////  tips = "Opera & IE not supported|Chrome & Safari sugguested"////
//////////////////////////////////////////////////////////////////////
window.returnValue=0;
var level_propId = null;
var getlevel_propUrl = "/level_prop/get/";
var editlevel_propUrl = "/level_prop/edit/";
var currentlevel_prop = null;
$(document).ready(function() {
	level_propId = window.dialogArguments;
	$.ajax({
		   type: "GET",
		   url: getlevel_propUrl,
		   data: "level_propId=" + level_propId,
		   dataType: "json",
		   success: function(data) {
			   if(data.code > 0) {
				   var result = data.result;
				   $("#level_propId").val(result.level_propId);
				   $("#deployId").val(result.deployId);
				   $("#exp").val(result.exp);
				   $("#energyMax").val(result.energyMax);
				   $("#battleCount").val(result.battleCount);
				   $("#employeeCount").val(result.employeeCount);
				   $("#skillCount").val(result.skillCount);
				   $("#hp").val(result.hp);
				   $("#physicalatk").val(result.physicalatk);
				   $("#physicaldef").val(result.physicaldef);
				   $("#magicatk").val(result.magicatk);
				   $("#magicdef").val(result.magicdef);
				   $("#award").val(result.award);
				   $("#logos").val(result.logos);
				   				   
				   currentlevel_prop = result; 
				   listselectors();
				   window.returnValue=1;
			   }else {
				   errDialog(data.message);
			   }
		   }
	});
});

function listselectors() {
}

function editlevel_prop() {
	var level_propIdParam = "level_propId=" + level_propId;
	var expValue = $("#exp").val();
	if(!checkInteger("经验",expValue,false)) {
		return;
	}
	var expParam = "exp=" + xparseInt(expValue);
		
	var energyMaxValue = $("#energyMax").val();
	if(!checkInteger("精力最大值",energyMaxValue,false)) {
		return;
	}
	var energyMaxParam = "energyMax=" + xparseInt(energyMaxValue);
		
	var battleCountValue = $("#battleCount").val();
	if(!checkInteger("出战人数上限",battleCountValue,false)) {
		return;
	}
	var battleCountParam = "battleCount=" + xparseInt(battleCountValue);
		
	var employeeCountValue = $("#employeeCount").val();
	if(!checkInteger("雇佣英雄上限",employeeCountValue,false)) {
		return;
	}
	var employeeCountParam = "employeeCount=" + xparseInt(employeeCountValue);
		
	var skillCountValue = $("#skillCount").val();
	if(!checkInteger("技能数上限",skillCountValue,false)) {
		return;
	}
	var skillCountParam = "skillCount=" + xparseInt(skillCountValue);
		
	var hpValue = $("#hp").val();
	if(!checkInteger("血量",hpValue,false)) {
		return;
	}
	var hpParam = "hp=" + xparseInt(hpValue);
		
	var physicalatkValue = $("#physicalatk").val();
	if(!checkInteger("物理攻击力",physicalatkValue,false)) {
		return;
	}
	var physicalatkParam = "physicalatk=" + xparseInt(physicalatkValue);
		
	var physicaldefValue = $("#physicaldef").val();
	if(!checkInteger("物理防御力",physicaldefValue,false)) {
		return;
	}
	var physicaldefParam = "physicaldef=" + xparseInt(physicaldefValue);
		
	var magicatkValue = $("#magicatk").val();
	if(!checkInteger("魔法攻击力",magicatkValue,false)) {
		return;
	}
	var magicatkParam = "magicatk=" + xparseInt(magicatkValue);
		
	var magicdefValue = $("#magicdef").val();
	if(!checkInteger("魔法防御力",magicdefValue,false)) {
		return;
	}
	var magicdefParam = "magicdef=" + xparseInt(magicdefValue);
		
	var awardValue = $("#award").val();
	
	var awardParam = "award=" + awardValue;
		
	var logosValue = $("#logos").val();
	
	var logosParam = "logos=" + logosValue;
			
	$.ajax({
		   type: "POST",
		   url: editlevel_propUrl,
		   		   data:  level_propIdParam + '&' +  expParam  +'&'+   energyMaxParam  +'&'+   battleCountParam  +'&'+   employeeCountParam  +'&'+   skillCountParam  +'&'+   hpParam  +'&'+   physicalatkParam  +'&'+   physicaldefParam  +'&'+   magicatkParam  +'&'+   magicdefParam  +'&'+   awardParam  +'&'+   logosParam  ,
		   dataType: "json",
		   success: function(data) {
			   if(data.code > 0) {
			   	   beforeWindowClose();
				   window.close();
			   }else {
				   errDialog(data.message);
			   }
		   }
	});
}

	
	
	
	
	
	
	
	
	
	
			function addaward() {
			var awardstr = $('#award').val();
			var returnCallback = function(retvalue) {
				$('#award').val(retvalue);
			}
			openDialog("/pages/customer/RewardEntity.html",awardstr,"dialogWidth:600px;dialogHeight:600px;status:no;help:no;center:yes",returnCallback);
		}
	
			function addlogos() {
			var logosstr = $("#logos").val();
			var returnCallback = function(retvalue) {
				$('#logos').val(retvalue);
			}
			openDialog("/pages/core/SimpleArray.html",[1,logosstr],"dialogWidth:600px;dialogHeight:600px;status:no;help:no;center:yes",returnCallback);
		}
	
function openResource(fieldname,dependfield) {
	var param = "";
	if(dependfield!="") {
		param = $("#" + dependfield).val()
		if(param == null || param == "") {
			alert("你先把【" + $("#lbl_" + dependfield).html() + "】填了再上传");
			return;
		}
	}
	resourceDialog("level_prop",$("#" + fieldname).val(),param,function(result) {
		if(result != undefined && result != "") {
			$("#" + fieldname).val(result);
		}
	});
}

function beforeWindowClose() {
	if(window.returnCallback) {
		window.returnCallback(window.returnValue);
	}
	window.onbeforeunload = null;
	return true;
}

</script>
<body onunload="beforeWindowClose()">
	<div class="addarea">
	<form action="/level_prop/add" method="post">
		<table>
			<tbody>
				<tr>
					<td>ID</td><td><input type="text" id="level_propId" name="level_propId" disabled/></td>
					<td>发布Id</td><td><input type="text" id="deployId" name="deployId" disabled/></td>
				</tr>
			</tbody>
		</table>
		<table>
			<tbody>				
					<tr>					<td>
						<label for="exp" id="lbl_exp">经验</label>
													<input type="text" id="exp" name="exp" /><span class="tips">[整数]</span>
											</td>
									
										<td>
						<label for="energyMax" id="lbl_energyMax">精力最大值</label>
													<input type="text" id="energyMax" name="energyMax" /><span class="tips">[整数]</span>
											</td>
					</tr>				
					<tr>					<td>
						<label for="battleCount" id="lbl_battleCount">出战人数上限</label>
													<input type="text" id="battleCount" name="battleCount" /><span class="tips">[整数]</span>
											</td>
									
										<td>
						<label for="employeeCount" id="lbl_employeeCount">雇佣英雄上限</label>
													<input type="text" id="employeeCount" name="employeeCount" /><span class="tips">[整数]</span>
											</td>
					</tr>				
					<tr>					<td>
						<label for="skillCount" id="lbl_skillCount">技能数上限</label>
													<input type="text" id="skillCount" name="skillCount" /><span class="tips">[整数]</span>
											</td>
									
										<td>
						<label for="hp" id="lbl_hp">血量</label>
													<input type="text" id="hp" name="hp" /><span class="tips">[整数]</span>
											</td>
					</tr>				
					<tr>					<td>
						<label for="physicalatk" id="lbl_physicalatk">物理攻击力</label>
													<input type="text" id="physicalatk" name="physicalatk" /><span class="tips">[整数]</span>
											</td>
									
										<td>
						<label for="physicaldef" id="lbl_physicaldef">物理防御力</label>
													<input type="text" id="physicaldef" name="physicaldef" /><span class="tips">[整数]</span>
											</td>
					</tr>				
					<tr>					<td>
						<label for="magicatk" id="lbl_magicatk">魔法攻击力</label>
													<input type="text" id="magicatk" name="magicatk" /><span class="tips">[整数]</span>
											</td>
									
										<td>
						<label for="magicdef" id="lbl_magicdef">魔法防御力</label>
													<input type="text" id="magicdef" name="magicdef" /><span class="tips">[整数]</span>
											</td>
					</tr>				
					<tr>					<td>
						<label for="award" id="lbl_award">升级奖励</label>
													<input type="text" id="award" name="award" value="{}" disabled/>
							<input type="button" value="..." onclick="addaward()"/>
											</td>
									
										<td>
						<label for="logos" id="lbl_logos">升级解</label>
													<input type="text" id="logos" name="logos" value="[]" disabled/>
							<input type="button" value="..." onclick="addlogos()"/>
											</td>
					</tr>							</tbody>
		</table>
		<input type="button" onclick="editlevel_prop()" value="修改"/>
	</form>
	</div>
</body>